package es.unileon.is.finalproyect.temporizer;

import java.util.ArrayList;
import java.util.List;

public class TimeEventHandler {
	
	private List<TimeListener> _listeners = new ArrayList<TimeListener>();
	
	public void addTimeListener(TimeListener tl){
		_listeners.add(tl);
	}
	
	public void removeTimeListener(TimeListener tl){
		_listeners.remove(tl);
	}
	
	public void fireNewTime(TimeSource source, int seconds){
		TimeEvent te = new TimeEvent(source, seconds);
		for(TimeListener tl: _listeners){
			tl.newTime(te);
		}
	}
}
